import { request } from '/@/utils/service';
import type { PageQuery, addOrEditDataType } from './info.types';


/**
 * @description 获取药品分类列表
 * @param params 列表请求参数
 */
export function infoListAPI(params: PageQuery) {
	return request({
		method: 'GET',
		url: '/api/drug/medicine/orders/',
		params,
	});
}

/**
 * @description 添加药品分类
 * @param data 请求体参数
 * @returns
 */
export function infoAddAPI(data: addOrEditDataType) {
	return request({
		method: 'POST',
		url: '/api/drug/medicine/orders/',
		data,
	});
}

/**
 * @description 编辑药品分类
 * @param data 请求体参数
 * @returns
 */
export function infoEditAPI(data: addOrEditDataType) {
	return request({
		method: 'PUT',
		url: `/api/drug/medicine/orders/${data.id}/`,
		data,
	});
}

/**
 * @description 删除药品分类
 * @param id 类别id
 * @returns
 */
export function infoDelAPI(id: number) {
	return request({
		method: 'DELETE',
		url: `/api/drug/medicine/orders/${id}/`,
	});
}
